#pragma once

#include <sfml/Window.hpp>
#include <vector>

class Scene;
class Graphics;
class GameObject;
class Chessman;
class Node;
class UIText;

typedef std::vector<GameObject*> GameObjectList;

class Game
{
public:
	Game(void);
	~Game(void);

	static Game* GetGame();
	
	bool Init();

	void Start();

	bool Update(float dt);

	bool ProcessEvent(sf::Event event);

	void SelectChessman(Chessman* chessman);

	void RemoveChessman(int x, int y);

	void MoveToPosition(int x, int y);

	Chessman* GetChessmanAtPosition(int x, int y);

private:

	GameObject* GetGameObjectByNode(Node* node);
	void ClearChessboard();

	Graphics* mGraphics;
	Scene* mGameScene;

	Chessman* mSelectedChessman;		

	Chessman* mChessboard[8][8];

	GameObjectList mGameObjects;

	int mCurrentPlayer;

	UIText* mTopButton;

	bool mStarted;
};
